﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace TableTop.Chat
{
    [DataContract(Namespace="http://www.tabletop.net/Chat")]  
    public class UserIdentifier
    {
        [DataMember]
        private Guid _clientid = Guid.Empty;
        [DataMember]
        private String _username = String.Empty;

        public Guid ClientID
        {
            get
            {
                return this._clientid;
            }
        }

        public String UserName
        {
            get
            {
                return this._username;
            }
        }

        public String FullIdentity
        {
            get
            {
                string strFullIdentity = String.Empty;

                strFullIdentity = String.Format("{0}@{1}",
                                                this.UserName,
                                                this.ClientID.ToString());
                return strFullIdentity;
            }
        }

        /// <summary>
        /// Base constructor, used prevalently for serialization/deserialization
        /// </summary>
        public UserIdentifier()
        {
        }

        public UserIdentifier(Guid ClientID, String UserName)
        {
            this._clientid = ClientID;
            this._username = UserName;
        }

        public override string ToString()
        {
            return this.FullIdentity;
        } 
    }
}
